#include "u_Oled.h"
#include "Menu.h"
#include "u_Key.h"
#include "u_Beep.h"
#include "User_App.h"
#include "bsp_soft_PWM.h"
#include "bsp_DS1302.h"
#include "Flash_Eeprom.h"
#include "bsp_port.h"
#include "bsp_Timer.h"
#include "bsp_Task.h"

#if 1

void Home_Chief(void);
void Setting_menu_Style(void);
void Setting_menu_Speed(void);
void WaterSetValue(void);
void Valve_Ctrl_Event(void);
void Circulate_Pump_State(void);
void Lamp_State(void);
void Lamp2_State(void);
void Wave_Pump_State(void);
void Brew_Water_State(void);
void Change_Water_State(void);
void Automatic_Add_Water_State(void);
void Brew_Water_Timer_Value(void);
void Automatic_Add_Water_Value(void);
void Expel_Pump_State(void);
void Supply_Pump_State(void);
void Oxygen_Pump_State(void);
void Heat_State(void);

void MenuVII_Time_Init(void);
void Timer_Year_Value(void);
void Timer_Moon_Value(void);
void Timer_Day_Value(void);
void Timer_Hour_Value(void);
void Timer_Minute_Value(void);

extern info_t info;
extern u_Task_t Add_Water;
extern u_Task_t Change_Water;
extern bsp_TIM_t Ti_Add_Water; // 定时补水

extern Menu_t MenuVI_Chief[];
extern Menu_t MenuVII_Automatic_Model[];
extern Menu_t MenuVII_Manual_Debug[];
extern Menu_t MenuVII_SetUp[];
extern Menu_t MenuVII_Info[];
extern Menu_t MenuVIII_Change_Water[];
extern Menu_t MenuVIII_Automatic_Brew_Water[];
extern Menu_t MenuVIII_Automatic_Add_Water[];
extern Menu_t MenuVIII_Timing_Change_Water[];
extern Menu_t MenuVIII_Timing_Lamp[];
extern Menu_t MenuVIII_Timing_Feed[];
extern Menu_t MenuVIII_Circulate_Pump[];
extern Menu_t MenuVIII_Expel_Pump[];
extern Menu_t MenuVIII_Supply_Pump[];
extern Menu_t MenuVIII_Oxygen_Pump[];
extern Menu_t MenuVIII_Heat[];
extern Menu_t MenuVIII_Lamp[];
extern Menu_t MenuVIII_Lamp_2[];
extern Menu_t MenuVIII_Wave_Pump[];
extern Menu_t MenuVIII_Timer[];
#endif

// 主菜单
Menu_t MenuVI_Chief[] = {
    {"<<<", Home_Chief, NULL},
    {"自动模式", NULL, MenuVII_Automatic_Model},
    {"手动模式", NULL, MenuVII_Manual_Debug},
    {"版本信息", NULL, MenuVII_Info},
    {".."},
};

// *******************  自动模式    *******************
//  二级菜单_自动模式
Menu_t MenuVII_Automatic_Model[] = {
    {"<<<", NULL, MenuVI_Chief},
    {"自动换水", NULL, MenuVIII_Change_Water}, //
    // {"定时灯光", NULL, MenuVIII_Timing_Lamp},          //
    {"自动困水", NULL, MenuVIII_Automatic_Brew_Water}, //
    {"自动补水", NULL, MenuVIII_Automatic_Add_Water},  //
    // {"定时换水", NULL, MenuVIII_Timing_Change_Water},  //
    {"定时喂食", NULL, MenuVIII_Timing_Feed}, //
    {".."},
};
/// 三级菜单_自动换水
Menu_t MenuVIII_Change_Water[] = {
    {"<<<", NULL, MenuVII_Automatic_Model},
    {"状态[关]", Change_Water_State},
    {".."},
};
/// 三级菜单_自动困水
Menu_t MenuVIII_Automatic_Brew_Water[] = {
    {"<<<", NULL, MenuVII_Automatic_Model},
    {"状态[关]", Brew_Water_State, NULL},
    {"困水时长:", Brew_Water_Timer_Value, NULL, NULL, 4},
    {".."},
};
/// 三级菜单_自动补水
Menu_t MenuVIII_Automatic_Add_Water[] = {
    {"<<<", NULL, MenuVII_Automatic_Model},
    {"状态[关]", Automatic_Add_Water_State},
    {"间隔(天):", Automatic_Add_Water_Value, NULL, NULL, 1},
    {".."},
};
/// 三级菜单_定时换水
Menu_t MenuVIII_Timing_Change_Water[] = {
    {"<<<", NULL, MenuVII_Automatic_Model},
    {"状态[关]", NULL},
    {"时间[12-00]", NULL},
    {".."},
};
/// 三级菜单_定时灯光
Menu_t MenuVIII_Timing_Lamp[] = {
    {"<<<", NULL, MenuVII_Automatic_Model},
    {"状态[关]", NULL},
    {"开始时间[12-00]", NULL},
    {"暂停时间[00-00]", NULL},
    {"时长h:", NULL, NULL, NULL, 3},
    {".."},
};
/// 三级菜单_定时喂食
Menu_t MenuVIII_Timing_Feed[] = {
    {"<<<", NULL, MenuVII_Automatic_Model},
    {"状态[关]", NULL},
    {"开始时间[12-00]", NULL},
    {"间隔T:", NULL, NULL, NULL, 2},
    {"投喂量:", NULL, NULL, NULL, 2},
    {".."},
};

// *******************  手动调试    *******************
// 二级菜单_手动调试
Menu_t MenuVII_Manual_Debug[] = {
    {"<<<", NULL, MenuVI_Chief},
    {"主循环泵", NULL, MenuVIII_Circulate_Pump},
    {"排水泵", NULL, MenuVIII_Expel_Pump},
    {"补水泵", NULL, MenuVIII_Supply_Pump},
    {"氧气泵", NULL, MenuVIII_Oxygen_Pump},
    {"造浪泵", NULL, MenuVIII_Wave_Pump},
    {"加热", NULL, MenuVIII_Heat},
    {"灯光", NULL, MenuVIII_Lamp},
    {"底滤补光", NULL, MenuVIII_Lamp_2},
    {"补水水位[0]", NULL, NULL},
    {"时间", MenuVII_Time_Init, MenuVIII_Timer},
    {".."},
};
/// 三级菜单_循环泵
Menu_t MenuVIII_Circulate_Pump[] = {
    {"<<<", NULL, MenuVII_Manual_Debug},
    {"状态[关]", Circulate_Pump_State},
    {".."},
};
/// 三级菜单_排水泵
Menu_t MenuVIII_Expel_Pump[] = {
    {"<<<", NULL, MenuVII_Manual_Debug},
    {"状态[关]", Expel_Pump_State},
    {".."},
};
/// 三级菜单_补水泵
Menu_t MenuVIII_Supply_Pump[] = {
    {"<<<", NULL, MenuVII_Manual_Debug},
    {"状态[关]", Supply_Pump_State},
    {".."},
};
/// 三级菜单_氧气泵
Menu_t MenuVIII_Oxygen_Pump[] = {
    {"<<<", NULL, MenuVII_Manual_Debug},
    {"状态[关]", Oxygen_Pump_State},
    {".."},
};
/// 三级菜单_加热
Menu_t MenuVIII_Heat[] = {
    {"<<<", NULL, MenuVII_Manual_Debug},
    {"状态[关]", Heat_State},
    {".."},
};
/// 三级菜单_灯光
Menu_t MenuVIII_Lamp[] = {
    {"<<<", NULL, MenuVII_Manual_Debug},
    {"状态[关]", Lamp_State},
    {".."},
};
/// 三级菜单_灯光2
Menu_t MenuVIII_Lamp_2[] = {
    {"<<<", NULL, MenuVII_Manual_Debug},
    {"状态[关]", Lamp2_State},
    {".."},
};
/// 三级菜单_造浪泵
Menu_t MenuVIII_Wave_Pump[] = {
    {"<<<", NULL, MenuVII_Manual_Debug},
    {"状态[关]", Wave_Pump_State},
    {".."},
};

/// 三级菜单_时间
Menu_t MenuVIII_Timer[] = {
    {"<<<", NULL, MenuVII_Manual_Debug},
    {"年:", Timer_Year_Value, NULL, NULL, 25},
    {"月:", Timer_Moon_Value, NULL, NULL, 05},
    {"日:", Timer_Day_Value, NULL, NULL, 07},
    {"时:", Timer_Hour_Value, NULL, NULL, 23},
    {"分:", Timer_Minute_Value, NULL, NULL, 30},
    {".."},
};

// *******************  设置    *******************
// 二级菜单_设置
Menu_t MenuVII_SetUp[] = {
    {"<<<", NULL, MenuVI_Chief},
    {"光标风格[反相]", Setting_menu_Style},
    {"动画速度[快]", Setting_menu_Speed},
    {".."},
};

// *******************  版本信息    *******************
// 二级菜单_信息
Menu_t MenuVII_Info[] = {
    {"<<<", NULL, MenuVI_Chief},
    {VERSION_NUMBER, NULL},
    {".."},
};

void u_OLED_Init(void)
{
    uint16_t RealityData = 0;

    OLED_Init();

    SetRunList = MenuVI_Chief;                                        // 运行界面设置成设置界面
    RealityData = (uint16_t)FLASH_EEPROM_Read(FLASH_ADD_WATER_TIMER); // 补水间隔数据读取
    MenuVIII_Automatic_Add_Water[2].Data = info.Automatic_Model_t.Add_Water_t.Timer_Len = RealityData;
}
// 主要界面
void Chief_Frame_UI(void)
{
    // OLED_ShowImage(104, 0, 24, 16, BatteryCharge_24x16); // 显示充电图像
    // OLED_ShowImage(0, 0, 24, 16, ICON_Link_24x16);       // 连接图标

    // 时间显示
    OLED_ShowNum(42, 5, info.Manual_Model_t.Timer_t.Hour, 2, OLED_6X8);             // 时
    OLED_ShowChar(42 + 16 - 4, 5, ':', OLED_6X8);                                   //
    OLED_ShowNum(42 + 16, 5, info.Manual_Model_t.Timer_t.Minute, 2, OLED_6X8);      // 分
    OLED_ShowChar(42 + 32 - 3, 5, ':', OLED_6X8);                                   //
    OLED_ShowNum(42 + 32 + 2, 5, info.Manual_Model_t.Timer_t.Seconds, 2, OLED_6X8); // 秒

    // 装饰线
    OLED_DrawLine(0, 18, 32, 18);   // 画线
    OLED_DrawLine(96, 18, 128, 18); // 画线
    OLED_DrawLine(0, 58, 32, 58);   // 画线
    OLED_DrawLine(96, 58, 128, 58); // 画线

    OLED_DrawLine(32, 18, 42, 24);  // 画线
    OLED_DrawLine(96, 18, 86, 24);  // 画线
    OLED_DrawLine(32, 58, 42, 50);  // 画线
    OLED_DrawLine(96, 58, 86, 50);  // 画线
    OLED_DrawCircle(64, 38, 20, 0); // 圆

    OLED_ShowNum(10, 29, 30, 2, OLED_8X16);                              // 水量数据
    OLED_ShowNum(57, 29, MenuVII_Automatic_Model[1].Data, 2, OLED_8X16); // 倒计时数据
    OLED_ShowNum(100, 29, 30, 2, OLED_8X16);                             // 加热时间数据

    if (1)
    {
        OLED_DrawLine(8, 26, 28, 26);    // 画线
        OLED_DrawLine(120, 26, 100, 26); // 画线
    }

    OLED_ShowChar(10 + 17, 36, '%', OLED_6X8);  // 显示百分号
    OLED_ShowChar(100 + 17, 36, 'm', OLED_6X8); // 显示秒
    OLED_ShowChar(62, 46, 's', OLED_6X8);       // 显示秒
}

void OLED_DataUpdate(void)
{
    //    if (LL_GPIO_IsInputPinSet(IN_SW1_GPIO_Port, IN_SW1_Pin) == 1) // 如果有水壶
    //    {
    //        MenuVII_Manual_Debug[3].Data = 1;
    //    }
    //    else
    //    {
    //        MenuVII_Manual_Debug[3].Data = 0;
    //    }
}
// 多级菜单调试
void OLED_Menu_Debug(void)
{
    OLED_Init();
    Beep_Init();

    SetRunList = MenuVI_Chief; // 运行界面设置成设置界面

    OLED_Obj_Set_Data(&MenuVII_Automatic_Model[1], 95);
    OLED_Obj_Set_Data(&MenuVII_Manual_Debug[4], 90);

    while (1)
    {
        OLED_Menu_Handle();
        KEY_All_event_Handle();
    }
}

/****************************************************************************************/
// 返回主页面
void Home_Chief(void)
{
    OLED_Menu_Set_RunListFlag(0);
    KEY_obj_setOneClick_event(&Key_obj_01, Key_obj_01_oneClick_event);
    KEY_obj_setOTwoClick_event(&Key_obj_01, Key_obj_01_twoClick_event);
    KEY_obj_setOneClick_event(&Key_obj_02, Key_obj_02_oneClick_event);
    KEY_obj_setOTwoClick_event(&Key_obj_02, Key_obj_02_twoClick_event);
    KEY_obj_setOneClick_event(&Key_obj_03, Key_obj_03_oneClick_event);
    KEY_obj_setOTwoClick_event(&Key_obj_03, Key_obj_03_twoClick_event);
}

// 水量设置
void WaterSetValue(void)
{
    if (DataAlterFlag == 0)
    {
        DataAlterFlag = 1;
        StripY_Next = STRIPY_SHOW;
    }
    else if (DataAlterFlag == 1)
    {
        DataAlterFlag = 0;
        StripY_Next = STRIPY_HIDE;
    }
} /**********************************************************/
// 设置光标样式
void Setting_menu_Style(void)
{
    if (CurStyle == reverse)
    {
        CurStyle = mouse;
        // MenuVII_SetUp[1].Name = "光标风格[鼠标]";
        update_Data(MenuVII_SetUp[1].Name, 200);
    }
    else if (CurStyle == mouse)
    {
        CurStyle = frame;
        // MenuVII_SetUp[1].Name = "光标风格[矩形]";
        update_Data(MenuVII_SetUp[1].Name, 300);
    }
    else // if(CurStyle == frame)
    {
        CurStyle = reverse;
        MenuVII_SetUp[1].Name = "光标风格[反相]";
        update_Data(MenuVII_SetUp[1].Name, 400);
    }
}
// 设置动画速度
void Setting_menu_Speed(void)
{
    if (CursorRollSpeed == 8)
    {
        CursorRollSpeed = 16;
        MenuRollSpeed = 1.1;
        MenuVII_SetUp[2].Name = "动画速度[慢]";
    }
    else if (CursorRollSpeed == 16)
    {
        CursorRollSpeed = 1;
        MenuRollSpeed = 16;
        MenuVII_SetUp[2].Name = "动画速度[关]";
    }
    else // if(CursorRollSpeed == 16)
    {
        CursorRollSpeed = 8;
        MenuRollSpeed = 2;
        MenuVII_SetUp[2].Name = "动画速度[快]";
    }
}
// 阀控制事件
void Valve_Ctrl_Event(void)
{
    //    if (tc_IsInputPinSet(1) == 1) // 如果阀是打开的
    //    {
    //        MenuVII_Manual_Debug[2].Name = "阀门[关]";
    //        tc_ResetOutputPin(1);
    //    }
    //    else
    //    {
    //        MenuVII_Manual_Debug[2].Name = "阀门[开]";
    //        tc_SetOutputPin(1);
    //    }
}
// 主循环泵控制
void Circulate_Pump_State(void)
{
    if (MenuVIII_Circulate_Pump[1].Name == "状态[开]")
    {
        MenuVIII_Circulate_Pump[1].Name = "状态[关]";
        bsp_Ctrl_Circulate_Pump(OFF_s);
    }
    else
    {
        MenuVIII_Circulate_Pump[1].Name = "状态[开]";
        bsp_Ctrl_Circulate_Pump(ON_s);
    }
}
// 灯光状态控制
void Lamp_State(void)
{
    if (MenuVIII_Lamp[1].Name == "状态[开]")
    {
        MenuVIII_Lamp[1].Name = "状态[关]";
        bsp_Ctrl_Lamp(OFF_s);
    }
    else
    {
        MenuVIII_Lamp[1].Name = "状态[开]";
        bsp_Ctrl_Lamp(ON_s);
    }
}
// 灯光2状态控制
void Lamp2_State(void)
{
    if (MenuVIII_Lamp_2[1].Name == "状态[开]")
    {
        MenuVIII_Lamp_2[1].Name = "状态[关]";
        bsp_Ctrl_Down_Lamp(OFF_s);
    }
    else
    {
        MenuVIII_Lamp_2[1].Name = "状态[开]";
        bsp_Ctrl_Down_Lamp(ON_s);
    }
}
// 造浪泵状态控制
void Wave_Pump_State(void)
{
    if (MenuVIII_Wave_Pump[1].Name == "状态[开]")
    {
        MenuVIII_Wave_Pump[1].Name = "状态[关]";
        bsp_Ctrl_Wave_Pump(OFF_s);
    }
    else
    {
        MenuVIII_Wave_Pump[1].Name = "状态[开]";
        bsp_Ctrl_Wave_Pump(ON_s);
    }
}
// 自动换水状态控制
void Change_Water_State(void)
{
    if (MenuVIII_Change_Water[1].Name == "状态[开]")
    {
        MenuVIII_Change_Water[1].Name = "状态[关]";
        info.Automatic_Model_t.Change_Water_t.State = 0;
        bsp_Task_Obj_Set_Stop(&Change_Water);
    }
    else
    {
        MenuVIII_Change_Water[1].Name = "状态[开]";
        info.Automatic_Model_t.Change_Water_t.State = 1;
        bsp_Task_Obj_Set_Run(&Change_Water);
    }
}
// 困水状态控制
void Brew_Water_State(void)
{
    if (MenuVIII_Automatic_Brew_Water[1].Name == "状态[开]")
    {
        MenuVIII_Automatic_Brew_Water[1].Name = "状态[关]";
        info.Automatic_Model_t.Brew_Water_t.State = 0;
        // bsp_Ctrl_Lamp(OFF_s);
    }
    else
    {
        MenuVIII_Automatic_Brew_Water[1].Name = "状态[开]";
        info.Automatic_Model_t.Brew_Water_t.State = 1;
        // bsp_Ctrl_Lamp(ON_s);
    }
}
// 自动补水状态控制
void Automatic_Add_Water_State(void)
{
    if (MenuVIII_Automatic_Add_Water[1].Name == "状态[开]")
    {
        MenuVIII_Automatic_Add_Water[1].Name = "状态[关]";
        info.Automatic_Model_t.Add_Water_t.State = 0;
        Ti_obj_Set_Stop(&Ti_Add_Water);
        bsp_Task_Obj_Set_Stop(&Add_Water);
        // bsp_Ctrl_Lamp(OFF_s);
    }
    else
    {
        MenuVIII_Automatic_Add_Water[1].Name = "状态[开]";
        info.Automatic_Model_t.Add_Water_t.State = 1;

        bsp_Ti_Set_mDelay(3000);                                                                    // 延时运行任务，增加体验感
        Ti_obj_Set_Cycle(&Ti_Add_Water, ONE_DAY_MS * info.Automatic_Model_t.Add_Water_t.Timer_Len); // 设置自动补水周期
        bsp_Task_Obj_Set_Run(&Add_Water);                                                           // 先运行一次补水任务
        Ti_obj_Set_Reset(&Ti_Add_Water);
        // bsp_Ctrl_Lamp(ON_s);
    }
}
// 困水时间修改
void Brew_Water_Timer_Value(void)
{
    uint16_t RealityData = (uint16_t)info.Automatic_Model_t.Brew_Water_t.Timer_Len;
    OLED_DataAlter_Function(&RealityData, MenuVIII_Automatic_Brew_Water[2].Data, FLASH_BREW_WATER_TIMER); // 弹窗处理数据
    info.Automatic_Model_t.Brew_Water_t.Timer_Len = (uint8_t)RealityData;
}
// 补水间隔修改
void Automatic_Add_Water_Value(void)
{
    uint16_t RealityData = (uint16_t)info.Automatic_Model_t.Add_Water_t.Timer_Len;
    OLED_DataAlter_Function(&RealityData, MenuVIII_Automatic_Add_Water[2].Data, FLASH_ADD_WATER_TIMER); // 弹窗处理数据
    info.Automatic_Model_t.Add_Water_t.Timer_Len = (uint8_t)RealityData;
    Ti_obj_Set_Cycle(&Ti_Add_Water, ONE_DAY_MS * info.Automatic_Model_t.Add_Water_t.Timer_Len);
}

/*  @brief  时间_初始化
    @return 无
    @property 无
*/
void MenuVII_Time_Init(void)
{
    MenuVIII_Timer[1].Data = DS1302_Read_Reg(0x8D); // 读年
    MenuVIII_Timer[2].Data = DS1302_Read_Reg(0x89); // 读月
    MenuVIII_Timer[3].Data = DS1302_Read_Reg(0x87); // 读日
    MenuVIII_Timer[4].Data = DS1302_Read_Reg(0x85); // 读时
    MenuVIII_Timer[5].Data = DS1302_Read_Reg(0x83); // 读分
    MenuVIII_Timer[6].Data = DS1302_Read_Reg(0x81); // 读秒
    // enuVIII_Timer[7].Data = DS1302_Read_Reg(0x8B);    // 读星期
}

/*  @brief  时间_年 修改
    @return 无
    @property 无
*/
void Timer_Year_Value(void)
{
    uint16_t RealityData = (uint16_t)info.Manual_Model_t.Timer_t.Year;
    OLED_DataAlter_Function(&RealityData, MenuVIII_Timer[1].Data, NULL); // 弹窗处理数据
    info.Manual_Model_t.Timer_t.Year = (uint8_t)RealityData;
    DS1302_Set_Time(YEAR, info.Manual_Model_t.Timer_t.Year); // 年
}
/*  @brief  时间_月 修改
    @return 无
    @property 无
*/
void Timer_Moon_Value(void)
{
    uint16_t RealityData = (uint16_t)info.Manual_Model_t.Timer_t.Moon;
    OLED_DataAlter_Function(&RealityData, MenuVIII_Timer[2].Data, NULL); // 弹窗处理数据
    info.Manual_Model_t.Timer_t.Moon = (uint8_t)RealityData;
    DS1302_Set_Time(MONTH, info.Manual_Model_t.Timer_t.Moon); // 月
}
/*  @brief  时间_日 修改
    @return 无
    @property 无
*/
void Timer_Day_Value(void)
{
    uint16_t RealityData = (uint16_t)info.Manual_Model_t.Timer_t.Day;
    OLED_DataAlter_Function(&RealityData, MenuVIII_Timer[3].Data, NULL); // 弹窗处理数据
    info.Manual_Model_t.Timer_t.Day = (uint8_t)RealityData;
    DS1302_Set_Time(DAY, info.Manual_Model_t.Timer_t.Day); // 日
}
/*  @brief  时间_时 修改
    @return 无
    @property 无
*/
void Timer_Hour_Value(void)
{
    uint16_t RealityData = (uint16_t)info.Manual_Model_t.Timer_t.Hour;
    OLED_DataAlter_Function(&RealityData, MenuVIII_Timer[4].Data, NULL); // 弹窗处理数据
    info.Manual_Model_t.Timer_t.Hour = (uint8_t)RealityData;
    DS1302_Set_Time(HOUR, info.Manual_Model_t.Timer_t.Hour); // 时
}
/*  @brief  时间_分 修改
    @return 无
    @property 无
*/
void Timer_Minute_Value(void)
{
    uint16_t RealityData = (uint16_t)info.Manual_Model_t.Timer_t.Minute;
    OLED_DataAlter_Function(&RealityData, MenuVIII_Timer[5].Data, NULL); // 弹窗处理数据
    info.Manual_Model_t.Timer_t.Minute = (uint8_t)RealityData;
    DS1302_Set_Time(MINUTE, info.Manual_Model_t.Timer_t.Minute); // 分
    info.Manual_Model_t.Timer_t.Seconds = MenuVIII_Timer[6].Data = 1;
    DS1302_Set_Time(SECOND, info.Manual_Model_t.Timer_t.Seconds); // 秒
}
// 补水泵控制
void Supply_Pump_State(void)
{
    if (MenuVIII_Supply_Pump[1].Name == "状态[开]")
    {
        MenuVIII_Supply_Pump[1].Name = "状态[关]";
        info.Manual_Model_t.Supply_Pump_t.State = 0;
        bsp_Ctrl_Supply_Pump(OFF_s);
    }
    else
    {
        MenuVIII_Supply_Pump[1].Name = "状态[开]";
        info.Manual_Model_t.Supply_Pump_t.State = 1;
        bsp_Ctrl_Supply_Pump(ON_s);
    }
}
// 排水泵控制
void Expel_Pump_State(void)
{
    if (MenuVIII_Expel_Pump[1].Name == "状态[开]")
    {
        MenuVIII_Expel_Pump[1].Name = "状态[关]";
        info.Manual_Model_t.Expel_Pump_t.State = 0;
        bsp_Ctrl_Expel_Pump(OFF_s);
    }
    else
    {
        MenuVIII_Expel_Pump[1].Name = "状态[开]";
        info.Manual_Model_t.Expel_Pump_t.State = 1;
        bsp_Ctrl_Expel_Pump(ON_s);
    }
}
// 氧气泵控制
void Oxygen_Pump_State(void)
{
    if (MenuVIII_Oxygen_Pump[1].Name == "状态[开]")
    {
        MenuVIII_Oxygen_Pump[1].Name = "状态[关]";
        // info.Manual_Model_t.Expel_Pump_t.State = 0;
        bsp_Ctrl_Oxygen_Pump(OFF_s);
    }
    else
    {
        MenuVIII_Oxygen_Pump[1].Name = "状态[开]";
        // info.Manual_Model_t.Expel_Pump_t.State = 1;
        bsp_Ctrl_Oxygen_Pump(ON_s);
    }
}

// 加热器控制
void Heat_State(void)
{
    if (MenuVIII_Heat[1].Name == "状态[开]")
    {
        MenuVIII_Heat[1].Name = "状态[关]";
        // info.Manual_Model_t.Expel_Pump_t.State = 0;
        bsp_Ctrl_Fishbowl_Heat(OFF_s);
    }
    else
    {
        MenuVIII_Heat[1].Name = "状态[开]";
        // info.Manual_Model_t.Expel_Pump_t.State = 1;
        bsp_Ctrl_Fishbowl_Heat(ON_s);
    }
}
